﻿Namespace ArphoonTest
    Partial Public Class Validation
        Public Shared Function DataValidationTest(ByRef engine As Arps.Engine, ByRef errors As ULong) As Boolean
            Try
                AddLogC("Checking files...")
                AddLogC()
                Dim i As Integer
                For i = 0 To engine.MountedPackage.File.Length - 1
                    RewriteC("[" & i + 1 & "/" & engine.MountedPackage.File.Length & "] Checking file <" & engine.FileValidation(i).Filename & ">")

                    If Not engine.FileValidation(i).Validate() Then
                        RewriteC("ERROR: File Validation failed for file id: " & i)
                        AddLogC("   fn: " & engine.FileValidation(i).FullName)
                        AddLogC("   sf: " & engine.FileValidation(i).Filename)
                        AddLogC()
                        errors += 1
                    End If
                Next

                RewriteC("File check complete.")
                Return True
            Catch ex As Exception
                errors += 1
                AddLogC("ERROR: Failed to check files. Engine Exception.")
                AddLogC("   EX: " & ex.Message)
                Return False
            End Try
        End Function
    End Class
End Namespace
